<template>
	<view>
	<!-- 开启消息提示 -->
	<u-toast ref="uToast" />
	<view class="u-m-t-30 u-m-l-30 u-font-18 u-title" >感谢你的珍贵意见</view>
	<u-form :model="form" ref="uForm" class="u-m-l-30 u-text-center" label-position="top" :border="true">
		<u-form-item label="反馈" class="u-m-r-20" ><u-input v-model="form.context" type="textarea" :border="true" placeholder="请填写反馈"/></u-form-item>
<!-- 		<u-form-item label="图片信息">
		<u-upload :action="action" ></u-upload>
		</u-form-item> -->
		
     </u-form>
	 <u-button type="primary"  class="u-m-t-50 u-m-l-20 u-m-r-20" @click="submit">提交</u-button>
	 </view>
</template>

<script>
	export default {
		data() {
			
			return {
				action:'http://www.example.com/upload',
				form:{
					context:'',
		
				}
			}
		},
		methods: {
			submit(){
				// 云函数
				uniCloud.callFunction({
								name: "idea",
								data: {
									user_id:uni.getStorageSync('storage_user')!=''?uni.getStorageSync('storage_user').data[0]._id:'游客评论',
									context:this.form.context,
									type: "addIdea"
								},
								success: (res) => {
									if(res.result.state!=200){
										//提示消息
										this.$refs.uToast.show({
												title: "反馈失败！",
												type: 'error',//提示文字
												url: '/pages/user/index',//跳转
												position:"top",
												duration:'1000',//时间
												icon:false
												})
										return;
									}
									//成功
									//提示消息
									this.$refs.uToast.show({
											title: "反馈成功，谢谢你的建议！",
											type: 'success',//提示文字
											position:"top",
											icon:false,
											duration:'1000',//时间
											})
					
								},
								fail: (err) => {
									console.log(err)
								}
							})
							
						}
			}
		
	}
</script>

<style>
.footbox{
/* 	position: fixed;
	bottom: 10rpx;
	height: 70rpx;
	right: 270rpx; */
}
</style>
